﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Com.CMS263.DAO;
using Com.CMS263.PO;

namespace Com.CMS263.BLL
{
    public class TicketBLL : BaseBLL<Ticket>
    {
        TicketDAO dao = new TicketDAO();
        public Ticket entity = new Ticket();
        public override Ticket GetModel()
        {
            return entity;
        }

        /// <summary>
        /// 检查验证码是否已经存在
        /// </summary>
        /// <param name="ticketNo"></param>
        /// <returns></returns>
        public bool IsExist(string ticketNo)
        {
            return dao.IsExist(ticketNo);
        }
        /// <summary>
        /// 检查订单是否存在
        /// </summary>
        /// <param name="orderId"></param>
        /// <returns></returns>
        public bool IsExistByOrderId(string orderId)
        {
            return dao.IsExistByOrderId(orderId);
        }

        #region 根据Groupid查询
        /// <summary>
        ///  根据Groupid查询
        /// </summary>
        /// <param name="userid"></param>
        /// <returns></returns>
        public IList<Ticket> GetTicketByGroupid(int groupid, int page, int pagesize)
        {
            return dao.GetTicketByGroupid(groupid,page ,pagesize );
        }
        /// <summary>
        ///  根据Groupid查询团卷,用户导出excel
        /// </summary>
        /// <param name="userid"></param>
        /// <returns></returns>
        public IList<Ticket> GetTicketByGroupid(int groupid)
        {
            return dao.GetTicketByGroupid(groupid);
        }
        /// <summary>
        /// 根据Groupid查询团卷总数
        /// </summary>
        /// <param name="groupid"></param>
        /// <returns></returns>
        public int GetTickeByGroupid(int groupid)
        {
            return dao.GetTickeByGroupid(groupid);
        }
        #endregion
        
        #region 根据state返回总数
        /// <summary>
        /// 根据state返回总数
        /// </summary>
        /// <param name="state"></param>
        /// <returns></returns>
        public int GetContByState(int state,int groupid)
        {
            return dao.GetContByState(state,groupid );
        }
        #endregion
        
        #region
        /// <summary>
        /// 批量修改状态
        /// </summary>
        /// <param name="ids"></param>
        /// <param name="state"></param>
        /// <returns></returns>
        public int UpdateState(string ids, int state)
        {
            return dao.UpdateState(ids, state);
        }
        #endregion

        public IList<Ticket> GetTicket(int tj, int userId, int page, int pagesize)
        {
            return dao.GetTicket(tj, userId, page, pagesize);
        }
        public int GetTicket(int tj, int userId)
        {
            return dao.GetTicket(tj, userId);
        }

    }
}
